package car.aistar.controller.loadjsp;

import car.aistar.dto.TqxCarSelect;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Date;

/**
 * 本类用来：
 *
 * @ClassName buyCarJsp
 * @Author tqx
 * @Date 2020/10/12 20:26
 */
@Controller
@RequestMapping("/BuyCarJsp")
public class buyCarJsp {
//    BuyCarJsp/search
@RequestMapping("/search")
public  String t22(Model model, TqxCarSelect tqxCarSelect){
    model.addAttribute("TqxCarSelect",tqxCarSelect);
    return "buyCar/buyCar02";
}
    @RequestMapping("/search/{brId}/{csId}/{brName}/{csName}/{price}/{price1}/{price2}/{cSeat}/{orderPrice}/{orderFar}/{orderAge}/{createDate}/{likeStr}/{pageNow}/{pageSize}")
    public  String t2(Model model, TqxCarSelect tqxCarSelect){
        model.addAttribute("TqxCarSelect",tqxCarSelect);
        return "buyCar/buyCar02";
    }


    @RequestMapping("/toPage/{pageNow}/{pageSize}/{Nums}")
    public String t1(Model model , @PathVariable("pageNow") Integer pageNow, @PathVariable("pageSize") Integer pageSize, @PathVariable("Nums") Integer Nums){
        Integer pageNums = (int) Math.ceil(Nums*1.0/pageSize);
        model.addAttribute("pageNums",pageNums);
        return "page/buyCarpage02";

    }

    @RequestMapping("/search/{brId}/{brName}")
    public  String t2(Model model, @PathVariable("brId")Long brId,@PathVariable("brName")String brName){
        TqxCarSelect tqxCarSelect = new TqxCarSelect();
        tqxCarSelect.setBrId(brId);
        tqxCarSelect.setBrName(brName);
        model.addAttribute("TqxCarSelect",tqxCarSelect);
        return "buyCar/buyCar02";
    }

@RequestMapping("/search/{brId}/{brName}/{csId}/{csName}")
public  String t2(Model model, @PathVariable("brId")Long brId,@PathVariable("brName")String brName,@PathVariable("csId")Long csId,@PathVariable("csName")String csName){
    TqxCarSelect tqxCarSelect = new TqxCarSelect();
    tqxCarSelect.setBrId(brId);
    tqxCarSelect.setBrName(brName);
    tqxCarSelect.setCsId(csId);
    tqxCarSelect.setCsName(csName);
    model.addAttribute("TqxCarSelect",tqxCarSelect);
        return "buyCar/buyCar02";
}
@RequestMapping("/searchLike/{brId}/{brName}/{csId}/{csName}/{likeStr}")
public  String t3(Model model, @PathVariable("brId")Long brId,@PathVariable("brName")String brName,@PathVariable("csId")Long csId,@PathVariable("csName")String csName,@PathVariable("likeStr")String likeStr){
    TqxCarSelect tqxCarSelect = new TqxCarSelect();
    tqxCarSelect.setBrId(brId);
    tqxCarSelect.setBrName(brName);
    tqxCarSelect.setCsId(csId);
    tqxCarSelect.setCsName(csName);
    tqxCarSelect.setLikeStr(likeStr);
    model.addAttribute("TqxCarSelect",tqxCarSelect);
        return "buyCar/buyCar02";
}

}
